package com.test.design.example1.factorymethod;

import com.test.design.example1.carFactory.CarFactory;
import com.test.design.example1.carFactory.impl.BUSFactory;
import com.test.design.example1.carFactory.impl.BUSFactorys;
import com.test.design.example1.carFactory.impl.SUVFactory;
import com.test.design.example1.dto.Car;

/**
 * @program: design-patternz
 * @description: 使用工厂方法
 * @author: <a href="mailto:zhengjiaming@gtmap.cn">zhengjiaming</a>
 * @create: 2024-12-26 09:33
 **/
public class UserFactoryMethod {

    public static void main(String[] args) {
        if (false){
            //方法一
            Car car = new Car();
            car.setJg("1块钱");
            car.setXh("SUV");
            car.setYs("红色");
            System.out.println(ordinaryMethod(car));
        }else {
            if (true){
                CarFactory busFactory = new BUSFactory();
                Car busCar = busFactory.createCar();
                busCar.setJg("4块钱111");
                System.out.println(busCar);

                System.out.println(busFactory.createCar1());

                SUVFactory suvFactory = new SUVFactory();
                Car suvCar = suvFactory.createCar();
                suvCar.setJg("3块钱");
                System.out.println(suvCar);

                String res =
                        "七彩神仙鱼(6条) 200元" + "黄蜻蜓(3条) 40元" +
                        "魔门斯卡(10条) 120元" + "墨燕(2条-2) 30元" +
                        "红背埃(2条) 20元" + "圣菲利佩(2条-2) 60元" +
                        "绿洲(2条-1) 50元" + "蓝魔(2条) 20元" +
                        "圣塔伦(17条-1) 330元" + "钻石藩王(2条) 20元" +
                        "红头力关岛(3条) 70元" + "蓝颊马面(6条) 80元" +
                        "斯维尼关刀(3条) 60元" + "玻利维亚(5条-2) 50元" +
                        "皮瓦斯(3条) 45元" + "刚果美人(3条) 40元" +
                        "石美人(1条) 0元" + "蓝波子(3条-3) 40元" +
                        "金波子(1条-1) 20元" + "金鱼(2条-2) 60元" +
                        "黑尾大勾(25条) 50元" + "一眉道人(12条) 140元" +
                        "红线黑影(5条-1) 140元" + "红尾灯(3条) 30元" +
                        "金线金(5条) 60元" + "黑金红头(6条-2) 80元" +
                        "金翅珍珠鼠(11条-4) 100元" + "三间鼠(3条) 60元" +
                        "鳄鱼异性(1条) 110元" + "帝王血钻(6条) 340元" +
                        "帝王迷宫(3条) 30元" + "黄金胡子(4条) 0元" +
                        "阿莲卡红老虎(2条) 70元" + "龙钻坦克(2条) 320元" +
                        "豹纹清道夫(3条) 50元" +
                        "共计：146条" +
                        "合计：3000元";
                System.out.println(res);
            }else {
                BUSFactorys busFactorys = new BUSFactorys();
                Car car = busFactorys.createCar();
                car.setJg("10块钱");
                System.out.println(car);
            }
        }
    }

    //普通调用方法
    public static String ordinaryMethod(Car car){
        return "我买了一辆"+car.getYs()+"的"+car.getXh()+"花了我"+car.getJg();
    }

}
